<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/css/style.css">
<script language="JavaScript"
	src="<%=request.getContextPath()%>/js/util.js"></script>
<title><tiles:insert flush="false" attribute="title" /></title>
<script>
	function setValue(t){
		document.getElementById("pform:test").value = t;
	}
</script>
</head>
<body>
<f:view>
	<f:loadBundle basename="resource.bundle.messages" var="messages" />
	<h:form id="pform">
	<h:inputHidden validator="#{registrationBean.validator}" value="#{registrationBean.test}" id="test"></h:inputHidden>
		<rich:panel header="#{messages['company.member.registration']}">
			<h:panelGrid>
				<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
			</h:panelGrid>

			<h:panelGrid width="100%">
				<h:outputText value="#{messages['membership.info']}" styleClass="sub_header" />
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
				</h:panelGroup>
			</h:panelGrid>

			<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">

				<h:outputText></h:outputText>
				<t:message for="name" styleClass="error"></t:message>

				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="name" value="#{messages['name']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="name" required="#{registrationBean.checkFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.member.name}"></t:inputText>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="nameoncard" styleClass="error"></t:message>

				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="nameoncard" value="#{messages['name.on.card']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="nameoncard" required="#{registrationBean.checkFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.member.nameOnCard}"></t:inputText>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="statement" styleClass="error"></t:message>
			
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="statement" value="#{messages['statement']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:selectOneRadio id="statement" styleClass="standardText" value="#{registrationBean.memberComp.statementType}" required="#{registrationBean.checkFlag}">
						<f:selectItems value="#{registrationBean.statementTypeList}"/>
					</t:selectOneRadio>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="sendstatement" styleClass="error"></t:message>
			
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="sendstatement" value="#{messages['send.statement']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:selectOneRadio id="sendstatement" styleClass="standardText" value="#{registrationBean.memberComp.statement}" required="#{registrationBean.checkFlag}">
						<f:selectItems value="#{registrationBean.yesNoSelectList}"/>
					</t:selectOneRadio>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="othertimeshare" styleClass="error"></t:message>
			
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="othertimeshare" value="#{messages['member.of.other.timeshare']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:selectOneRadio id="othertimeshare" styleClass="standardText" value="#{registrationBean.memberComp.timeshareCompFlag}" required="#{registrationBean.checkFlag}">
						<f:selectItems value="#{registrationBean.yesNoSelectList}"/>
					</t:selectOneRadio>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="email" styleClass="error"></t:message>
				
			   <h:panelGroup>
				   	<h:outputText value="*" styleClass="standardText_Mandatory" />	
				    <h:outputLabel for="email" value="#{messages['email']}" styleClass="standardText_Label" />
			   </h:panelGroup>
			   <h:panelGroup>
			   	<t:inputText id="email" required="#{registrationBean.checkFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.email}">
			   		<t:validateEmail></t:validateEmail>
			   	</t:inputText>
			   </h:panelGroup>
			   
			   <%--<h:outputText></h:outputText>
				<t:message for="image" styleClass="error"></t:message>
				
				<h:panelGroup>
					<h:outputLabel for="image" value="#{messages['image']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputFileUpload id="image" storage="file" size="50"  required="false"></t:inputFileUpload>
				</h:panelGroup>--%>

			</t:panelGrid>
			
			<h:panelGrid width="100%">
				<h:outputText value="#{messages['company.info']}"
					styleClass="sub_header" />
			</h:panelGrid>
			
			<t:panelGrid id="compInfo" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
				<h:outputText></h:outputText>
				<t:message for="CompanyName" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
					<h:outputLabel for="CompanyName" value="#{messages['name']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="CompanyName" size="50" maxlength="50" required="#{registrationBean.checkFlag}" styleClass="standardText" value="#{registrationBean.memberComp.compName}"></t:inputText>
				
				
				
				<h:outputText></h:outputText>
				<t:message for="establish" styleClass="error"></t:message>
			
			    <h:panelGroup>
				    <h:outputLabel for="establish" value="#{messages['establish.date']}" styleClass="standardText_Label" />
			    </h:panelGroup>
			    <h:panelGroup>
			    	<t:inputCalendar
			    	id="establish"
						monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
						currentDayCellClass="currentDayCell" value="#{registrationBean.memberComp.dateIncorporation}"
						renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
						popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
						renderPopupButtonAsImage="true"
						styleClass="standardText" required="false">
			    	</t:inputCalendar>
			    </h:panelGroup>
			    
			    <h:outputText></h:outputText>
				<t:message for="RegNo" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
					<h:outputLabel for="RegNo" value="#{messages['registration.no']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="RegNo" size="50" maxlength="50" required="#{registrationBean.checkFlag}" styleClass="standardText" value="#{registrationBean.memberComp.registerNo}"></t:inputText>
				
				<h:outputText></h:outputText>
				<t:message for="AccRefNo" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
					<h:outputLabel for="AccRefNo" value="#{messages['account.reference.no']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="AccRefNo" size="50" maxlength="50" styleClass="standardText" required="#{registrationBean.checkFlag}" value="#{registrationBean.memberComp.accRefNo}"></t:inputText>
				
				<h:outputText></h:outputText>
				<t:message for="natureofbusiness" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <%--<h:outputText value="*" styleClass="standardText_Mandatory"/>--%>
					<h:outputLabel for="natureofbusiness" value="#{messages['nature.of.business']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="natureofbusiness" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.natureOfBuz}"></t:inputText>
				
				<h:outputText></h:outputText>
				<t:message for="contactperson" styleClass="error"></t:message>

				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="contactperson" value="#{messages['contact.person']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="contactperson" required="#{registrationBean.checkFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.contactPerson}"></t:inputText>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="designation" styleClass="error"></t:message>

				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="designation" value="#{messages['designation']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="designation" required="#{registrationBean.checkFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.designation}"></t:inputText>
				</h:panelGroup>
	    
				<h:outputText></h:outputText>
				<t:message for="CompanyAdress1" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			    	<h:outputLabel for="CompanyAdress1" value="#{messages['address']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="CompanyAdress1" size="50" maxlength="50"  required="#{registrationBean.checkFlag}" styleClass="standardText" value="#{registrationBean.memberComp.regAddress1}"></t:inputText>
			    
			    <h:outputText></h:outputText>
				<t:message for="CompanyAdress2" styleClass="error"></t:message>
			    
			    <h:panelGroup></h:panelGroup>
			    <h:panelGroup>
			    	<t:inputText id="CompanyAdress2" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.regAddress2}"></t:inputText>
			    </h:panelGroup>
			    
			    <h:outputText></h:outputText>
				<t:message for="CompanyPostcode" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" />
			    	<h:outputLabel for="CompanyPostcode" value="#{messages['postcode']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		    	<t:inputText id="CompanyPostcode" size="50" maxlength="5" required="#{registrationBean.checkFlag}" styleClass="standardText" 
		    	value="#{registrationBean.memberComp.regPostcode}">
		    		<t:validateRegExpr pattern="\d{5}|\d{4}"/>
		    	</t:inputText>
		    	
		    	<h:outputText></h:outputText>
				<t:message for="CompanyCity" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>		
			    	<h:outputLabel for="CompanyCity" value="#{messages['city']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		        <t:inputText id="CompanyCity" size="50" maxlength="50" required="#{registrationBean.checkFlag}" styleClass="standardText" value="#{registrationBean.memberComp.regCity}"></t:inputText>
			    	
			    <h:outputText></h:outputText>
				<t:message for="CompanyCountry" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			    <h:outputLabel for="CompanyCountry" value="#{messages['country']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		    	<t:selectOneMenu id="CompanyCountry" required="#{registrationBean.checkFlag}"  styleClass="standardText" value="#{registrationBean.indCompcountryId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{registrationBean.countrySelectList}" />
					<a4j:support event="onclick" reRender="CompanyState" ajaxSingle="true" />
		    	</t:selectOneMenu>
		    	
		    	<h:outputText></h:outputText>
				<t:message for="CompanyState" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" />
			   		<h:outputLabel for="CompanyState" value="#{messages['state']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		    	<t:selectOneMenu id="CompanyState" required="#{registrationBean.checkFlag}" styleClass="standardText" value="#{registrationBean.indCompStateId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{registrationBean.indCompStateSelectList}" />
		    	</t:selectOneMenu>
		    	
			    
			    <h:outputText></h:outputText>
				<t:message for="TelephoneNoOffice" styleClass="error"></t:message>
			    
			    <h:outputLabel for="TelephoneNoOffice" value="#{messages['telephone.no']}" styleClass="standardText_Label" />
		    	<t:inputText id="TelephoneNoOffice" required="false" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.compTel}">
		    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
		    	</t:inputText>
			    
			    <h:outputText></h:outputText>
				<t:message for="FaxNoOffice" styleClass="error"></t:message>	
			    
			    <h:outputLabel for="FaxNoOffice" value="#{messages['fax.no']}" styleClass="standardText_Label" />
		    	<t:inputText id="FaxNoOffice" required="false" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.compFax}">
		    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
		    	</t:inputText>
			</t:panelGrid>
			
			<h:panelGrid width="100%">
				<h:outputText value="#{messages['mailing.info']}"
					styleClass="sub_header" />
			</h:panelGrid>
			
			<t:panelGrid id="mailInfo" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
			
				<h:outputText></h:outputText>
				<t:message for="MailBy" styleClass="error"></t:message>
				
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="MailBy" value="#{messages['mail.by']}"
						styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:selectOneRadio id="MailBy" styleClass="standardText" required="#{registrationBean.checkFlag}" value="#{registrationBean.compMailSelect}">
						<f:selectItems value="#{registrationBean.compMailSelectList}" />
						<a4j:support event="onclick" reRender="mailInfo" ajaxSingle="true"/>
					</t:selectOneRadio>
				</h:panelGroup>
				
				
				<h:outputText></h:outputText>
				<t:message for="MailAddress1" styleClass="error"></t:message>
				
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!registrationBean.mailFlag}"/>
					<h:outputLabel for="MailAddress1" value="#{messages['mail.address']}" styleClass="standardText_Label" />
				</h:panelGroup>
				
			    <t:inputText id="MailAddress1" size="50" readonly="#{registrationBean.mailFlag}" maxlength="50" required="#{!registrationBean.mailFlag}" styleClass="standardText" value="#{registrationBean.memberComp.mailAddress1}"></t:inputText>
			     
			    <h:outputText></h:outputText>
				<t:message for="MailAddress2" styleClass="error"></t:message>
			     
			    <h:panelGroup></h:panelGroup>
			    <h:panelGroup>
			    	<t:inputText id="MailAddress2" readonly="#{registrationBean.mailFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.mailAddress2}"></t:inputText>
			    </h:panelGroup>
			    
			    <h:outputText></h:outputText>
				<t:message for="MailPostcode" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!registrationBean.mailFlag}"/>
					<h:outputLabel for="MailPostcode" value="#{messages['mail.postcode']}" styleClass="standardText_Label" />
				</h:panelGroup>
			    <t:inputText id="MailPostcode" readonly="#{registrationBean.mailFlag}" size="50" maxlength="5" required="#{!registrationBean.mailFlag}" styleClass="standardText" value="#{registrationBean.memberComp.mailPostcode}">
			    		<t:validateRegExpr pattern="\d{5}|\d{4}"/>
			    </t:inputText>
			    
			     <h:outputText></h:outputText>
				<t:message for="MailCity" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!registrationBean.mailFlag}"/>
					 <h:outputLabel for="MailCity" value="#{messages['mail.city']}" styleClass="standardText_Label" />
				</h:panelGroup>	
				<t:inputText readonly="#{registrationBean.mailFlag}" id="MailCity" required="#{!registrationBean.mailFlag}" size="50" maxlength="50" styleClass="standardText" value="#{registrationBean.memberComp.mailCity}"></t:inputText>
			
			    	
			    <h:outputText></h:outputText>
				<t:message for="MailCountry" styleClass="error"></t:message>
			    
			     <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!registrationBean.mailFlag}"/>
					 <h:outputLabel for="MailCountry" value="#{messages['mail.country']}" styleClass="standardText_Label" />
				</h:panelGroup>
		    	<t:selectOneMenu readonly="#{registrationBean.mailFlag}" id="MailCountry" required="#{!registrationBean.mailFlag}"  styleClass="standardText" value="#{registrationBean.indMailCountryId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{registrationBean.countrySelectList}"/>
		    		<a4j:support event="onclick" reRender="MailState" ajaxSingle="true"/>
		    	</t:selectOneMenu>
			    
			    <h:outputText></h:outputText>
				<t:message for="MailState" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{!registrationBean.mailFlag}"/>
					 <h:outputLabel for="MailState" value="#{messages['mail.state']}" styleClass="standardText_Label" />
				</h:panelGroup>
		    	<t:selectOneMenu readonly="#{registrationBean.mailFlag}" id="MailState" required="#{!registrationBean.mailFlag}"  styleClass="standardText" value="#{registrationBean.indMailStateId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{registrationBean.indMailStateSelectList}"/>
		    	</t:selectOneMenu>
			    
			   </t:panelGrid>
			
			<h:panelGrid width="100%">
				<h:outputText value="#{messages['nominee.info']}"
					styleClass="sub_header" />
			</h:panelGrid>
			
			<t:dataTable var="dependant" value="#{registrationBean.dependantList}" rows="20" width="50%">
				<t:column width="80%">
					<h:commandLink value="#{dependant.name}" styleClass="standardText_Label"></h:commandLink>
				</t:column>
				<t:column width="20%">
					<h:commandLink value="#{messages['remove']}" styleClass="standardText_Label" immediate="true" 
					actionListener="#{registrationBean.removeDependantListener}" ></h:commandLink>
					<f:param id="dependantId" value="#{dependant.newIcNo}"/>
				</t:column>
			</t:dataTable>
			<rich:spacer height="15"></rich:spacer>
			<t:panelGrid>
				<h:commandLink styleClass="standardText_Label" value="#{messages['add.more']}" action="#{registrationBean.navCreateNomimee}" onclick="setValue(1)"></h:commandLink>
			</t:panelGrid>
			
			<rich:spacer height="30"></rich:spacer>
			
			<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
				<t:outputText></t:outputText>
				<t:panelGroup>
				 	<h:commandButton value="#{messages['back']}" styleClass="button" action="home"  immediate="true"></h:commandButton>
				 	<f:verbatim>&nbsp;</f:verbatim>
		   			<h:commandButton value="#{messages['next']}" styleClass="button" action="#{registrationBean.selectPaymentOption}"></h:commandButton>
		   		</t:panelGroup>
			</t:panelGrid>
			
		</rich:panel>
	</h:form>
</f:view>
</body>
</html>
